<template>
  <el-button link type="text" @click="clickHandler" size="small" >
    <slot>编辑</slot> 
  </el-button>
</template>
<script>
import TableEditorDialogForm from '@/components/TableEditorDialogForm.vue'
import { createPromiseDialog } from '@/utils/createPromiseDialog'

export default {
  name: 'TableEditorButton',
  inject: ['index', 'editorIndex', 'row'],
  methods: {
    async clickHandler() {
      try{
        let formDialogComp = createPromiseDialog(TableEditorDialogForm)
        let res = await formDialogComp({ title: `[${this.row.objectName}]` + '项目' },{data: this.row})
        this.row = res
      }catch(e){
        console.log(e)
      }
    }
  }
}
</script>